/**
 */
package org.xtext.context.aware.eventX.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.xtext.context.aware.eventX.EventAttributes;
import org.xtext.context.aware.eventX.EventXPackage;
import org.xtext.context.aware.eventX.TimeTable;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Event Attributes</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.context.aware.eventX.impl.EventAttributesImpl#isHasRadius <em>Has Radius</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.EventAttributesImpl#getRadius <em>Radius</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.EventAttributesImpl#isHasTime <em>Has Time</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.EventAttributesImpl#getTime <em>Time</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.EventAttributesImpl#isHasTolerance <em>Has Tolerance</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.EventAttributesImpl#getTolerance <em>Tolerance</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EventAttributesImpl extends MinimalEObjectImpl.Container implements EventAttributes
{
  /**
   * The default value of the '{@link #isHasRadius() <em>Has Radius</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasRadius()
   * @generated
   * @ordered
   */
  protected static final boolean HAS_RADIUS_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isHasRadius() <em>Has Radius</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasRadius()
   * @generated
   * @ordered
   */
  protected boolean hasRadius = HAS_RADIUS_EDEFAULT;

  /**
   * The default value of the '{@link #getRadius() <em>Radius</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRadius()
   * @generated
   * @ordered
   */
  protected static final int RADIUS_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getRadius() <em>Radius</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRadius()
   * @generated
   * @ordered
   */
  protected int radius = RADIUS_EDEFAULT;

  /**
   * The default value of the '{@link #isHasTime() <em>Has Time</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasTime()
   * @generated
   * @ordered
   */
  protected static final boolean HAS_TIME_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isHasTime() <em>Has Time</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasTime()
   * @generated
   * @ordered
   */
  protected boolean hasTime = HAS_TIME_EDEFAULT;

  /**
   * The cached value of the '{@link #getTime() <em>Time</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTime()
   * @generated
   * @ordered
   */
  protected TimeTable time;

  /**
   * The default value of the '{@link #isHasTolerance() <em>Has Tolerance</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasTolerance()
   * @generated
   * @ordered
   */
  protected static final boolean HAS_TOLERANCE_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isHasTolerance() <em>Has Tolerance</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasTolerance()
   * @generated
   * @ordered
   */
  protected boolean hasTolerance = HAS_TOLERANCE_EDEFAULT;

  /**
   * The default value of the '{@link #getTolerance() <em>Tolerance</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTolerance()
   * @generated
   * @ordered
   */
  protected static final int TOLERANCE_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getTolerance() <em>Tolerance</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTolerance()
   * @generated
   * @ordered
   */
  protected int tolerance = TOLERANCE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected EventAttributesImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EventXPackage.Literals.EVENT_ATTRIBUTES;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isHasRadius()
  {
    return hasRadius;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHasRadius(boolean newHasRadius)
  {
    boolean oldHasRadius = hasRadius;
    hasRadius = newHasRadius;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.EVENT_ATTRIBUTES__HAS_RADIUS, oldHasRadius, hasRadius));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getRadius()
  {
    return radius;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRadius(int newRadius)
  {
    int oldRadius = radius;
    radius = newRadius;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.EVENT_ATTRIBUTES__RADIUS, oldRadius, radius));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isHasTime()
  {
    return hasTime;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHasTime(boolean newHasTime)
  {
    boolean oldHasTime = hasTime;
    hasTime = newHasTime;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.EVENT_ATTRIBUTES__HAS_TIME, oldHasTime, hasTime));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TimeTable getTime()
  {
    if (time != null && time.eIsProxy())
    {
      InternalEObject oldTime = (InternalEObject)time;
      time = (TimeTable)eResolveProxy(oldTime);
      if (time != oldTime)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, EventXPackage.EVENT_ATTRIBUTES__TIME, oldTime, time));
      }
    }
    return time;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TimeTable basicGetTime()
  {
    return time;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTime(TimeTable newTime)
  {
    TimeTable oldTime = time;
    time = newTime;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.EVENT_ATTRIBUTES__TIME, oldTime, time));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isHasTolerance()
  {
    return hasTolerance;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHasTolerance(boolean newHasTolerance)
  {
    boolean oldHasTolerance = hasTolerance;
    hasTolerance = newHasTolerance;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.EVENT_ATTRIBUTES__HAS_TOLERANCE, oldHasTolerance, hasTolerance));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getTolerance()
  {
    return tolerance;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTolerance(int newTolerance)
  {
    int oldTolerance = tolerance;
    tolerance = newTolerance;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.EVENT_ATTRIBUTES__TOLERANCE, oldTolerance, tolerance));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EventXPackage.EVENT_ATTRIBUTES__HAS_RADIUS:
        return isHasRadius();
      case EventXPackage.EVENT_ATTRIBUTES__RADIUS:
        return getRadius();
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TIME:
        return isHasTime();
      case EventXPackage.EVENT_ATTRIBUTES__TIME:
        if (resolve) return getTime();
        return basicGetTime();
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TOLERANCE:
        return isHasTolerance();
      case EventXPackage.EVENT_ATTRIBUTES__TOLERANCE:
        return getTolerance();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EventXPackage.EVENT_ATTRIBUTES__HAS_RADIUS:
        setHasRadius((Boolean)newValue);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__RADIUS:
        setRadius((Integer)newValue);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TIME:
        setHasTime((Boolean)newValue);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__TIME:
        setTime((TimeTable)newValue);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TOLERANCE:
        setHasTolerance((Boolean)newValue);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__TOLERANCE:
        setTolerance((Integer)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EventXPackage.EVENT_ATTRIBUTES__HAS_RADIUS:
        setHasRadius(HAS_RADIUS_EDEFAULT);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__RADIUS:
        setRadius(RADIUS_EDEFAULT);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TIME:
        setHasTime(HAS_TIME_EDEFAULT);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__TIME:
        setTime((TimeTable)null);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TOLERANCE:
        setHasTolerance(HAS_TOLERANCE_EDEFAULT);
        return;
      case EventXPackage.EVENT_ATTRIBUTES__TOLERANCE:
        setTolerance(TOLERANCE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EventXPackage.EVENT_ATTRIBUTES__HAS_RADIUS:
        return hasRadius != HAS_RADIUS_EDEFAULT;
      case EventXPackage.EVENT_ATTRIBUTES__RADIUS:
        return radius != RADIUS_EDEFAULT;
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TIME:
        return hasTime != HAS_TIME_EDEFAULT;
      case EventXPackage.EVENT_ATTRIBUTES__TIME:
        return time != null;
      case EventXPackage.EVENT_ATTRIBUTES__HAS_TOLERANCE:
        return hasTolerance != HAS_TOLERANCE_EDEFAULT;
      case EventXPackage.EVENT_ATTRIBUTES__TOLERANCE:
        return tolerance != TOLERANCE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (hasRadius: ");
    result.append(hasRadius);
    result.append(", radius: ");
    result.append(radius);
    result.append(", hasTime: ");
    result.append(hasTime);
    result.append(", hasTolerance: ");
    result.append(hasTolerance);
    result.append(", tolerance: ");
    result.append(tolerance);
    result.append(')');
    return result.toString();
  }

} //EventAttributesImpl
